import request from '@/utils/request'
// 渲染首页数据
export function listRole(condition, currentPage, pageSize) {
  return request({
    url: `/ucenter/role/page?condition=${condition}&currentPage=${currentPage}&pageSize=${pageSize}`,
    method: 'post'

  })
}

// 角色管理新增
export function addRole(data) {
  return request({
    url: '/ucenter/role/insert',
    method: 'post',
    data
  })
}
// 查询单个角色列表
export function getRole(id) {
  return request({
    url: `/ucenter/role/query/${id}`
  })
}
// 编辑角色确认信息
export function updateRole(data) {
  return request({
    url: '/ucenter/role/update',
    method: 'post',
    data
  })
}
// 删除角色
export function deleteRole(id) {
  return request({
    url: `/ucenter/role/delete/${id}`,
    method: 'post'
  })
}
// 获取资源信息
export function allocation() {
  return request({
    url: `/ucenter/resource/treeResource`
  })
}

// 分配资源
export function assignPerm(data) {
  return request({
    url: '/ucenter/roleRes/assign',
    method: 'post',
    data
  })
}
// 获取菜单数据
export function allocationApi() {
  return request({
    url: `/ucenter/menu/treeMenu`
  })
}
// 分配菜单
export function assignPermAPi(data) {
  return request({
    url: '/ucenter/roleMenu/assign',
    method: 'post',
    data
  })
}
// 取消菜单和资源
export function countermand(id) {
  return request({
    url: `/ucenter/menu/assign/query/${id}`
  })
}
